<template>
	<div>
		<div style="margin: 28rpx;display: flex;flex-wrap: wrap;justify-content: space-between;" v-if="sizheng.length != 0">
			<view class="box1" v-for="(itam,index) in sizheng" @click="tz(itam.id, itam.name)">
				<image :src="itam.faceUrl" mode=""></image>
				<text class="box1_text">{{itam.name}}</text>
			</view>
		</div>
		<div v-else>
			<div style="text-align: center; margin-top: 20rpx;">
				暂无数据
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				sizheng: []
			}
		},
		onLoad(option) {
			
			this.getMindByType(option.id);
			uni.setNavigationBarTitle({
				title: option.name || ""
			})
		},
		methods: {
			tz(id, name) {
				uni.navigateTo({
					url: "./detail?id=" + id + "&name=" + name
				})
			},
			getMindByType (mindTypeId) {
				this.pyReq(this.$http.getMindByType, { mindTypeId, pageNo: 1, pageSize: 99999 },(res) => {
					if(res.code == 0) {
						this.sizheng = res.result.records.map(item => {
							return {
								"faceUrl": item.faceUrl,
								"name": item.mindName,
								"id": item.mindId
							}
						});
					}
				});
			}
		}
	}
</script>

<style>
	.box1 {
		display: inline-block;
		width: 49%;
		background: #FFFFFF;
		-webkit-border-radius: 5px;
		border-radius: 5px;
		overflow: hidden;
		-webkit-box-shadow: 0px 1px 8px #d9d9d9;
		box-shadow: 0px 1px 8px #d9d9d9;
		margin-bottom: 20rpx;
	}
	.box1 > img{
		display: block;
		position: absolute;
		top: 0;
		left: 0;
		opacity: 0;
	}
	.box1>uni-image{
		height: 120px;
	}
	.box1_text{
		display: block;
		text-align: center;
		font-size: 13px;
		padding-bottom: 7px;
	}
</style>
